/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * LanguagePickFrame.java
 *
 * Created on Oct 14, 2011, 1:46:13 AM
 */
package odeoncinemaassignment;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import javax.swing.JOptionPane;


public class LanguagePickFrame extends javax.swing.JFrame {

    public LanguagePickFrame() {
        initComponents();
    }
    public static final String DATE_FORMAT_NOW = "dd MMM yyyy hh:mm"; // stores the date format.

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        languageButtonGroup = new javax.swing.ButtonGroup();
        jPanel1 = new javax.swing.JPanel();
        odeonLogoLbl = new javax.swing.JLabel();
        flagsPanel = new javax.swing.JPanel();
        franceButton = new javax.swing.JToggleButton();
        irelandButton = new javax.swing.JToggleButton();
        spainButton = new javax.swing.JToggleButton();
        jPanel3 = new javax.swing.JPanel();
        exitButtonFlagScreen = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setBackground(new java.awt.Color(0, 102, 255));

        jPanel1.setBackground(new java.awt.Color(0, 153, 153));

        odeonLogoLbl.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/odeon_logo.png"))); // NOI18N
        jPanel1.add(odeonLogoLbl);

        flagsPanel.setAutoscrolls(true);

        languageButtonGroup.add(franceButton);
        franceButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/France-128.png"))); // NOI18N
        franceButton.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 0, 0), 2));
        franceButton.setBorderPainted(false);
        franceButton.setContentAreaFilled(false);
        franceButton.setOpaque(true);
        franceButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                franceButtonMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                franceButtonMouseExited(evt);
            }
        });
        flagsPanel.add(franceButton);

        languageButtonGroup.add(irelandButton);
        irelandButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Ireland-128.png"))); // NOI18N
        irelandButton.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 0, 0), 2));
        irelandButton.setBorderPainted(false);
        irelandButton.setContentAreaFilled(false);
        irelandButton.setOpaque(true);
        irelandButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                irelandButtonMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                irelandButtonMouseExited(evt);
            }
        });
        irelandButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                irelandButtonActionPerformed(evt);
            }
        });
        flagsPanel.add(irelandButton);

        languageButtonGroup.add(spainButton);
        spainButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Spain-128.png"))); // NOI18N
        spainButton.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 0, 0), 2));
        spainButton.setBorderPainted(false);
        spainButton.setContentAreaFilled(false);
        spainButton.setOpaque(true);
        spainButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                spainButtonMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                spainButtonMouseExited(evt);
            }
        });
        flagsPanel.add(spainButton);

        exitButtonFlagScreen.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/house.png"))); // NOI18N
        exitButtonFlagScreen.setText("Exit");
        exitButtonFlagScreen.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exitButtonFlagScreenActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addContainerGap(386, Short.MAX_VALUE)
                .addComponent(exitButtonFlagScreen)
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(exitButtonFlagScreen))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 1024, Short.MAX_VALUE)
            .addGroup(layout.createSequentialGroup()
                .addGap(547, 547, 547)
                .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
            .addComponent(flagsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 1024, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(flagsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 337, Short.MAX_VALUE)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void exitButtonFlagScreenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitButtonFlagScreenActionPerformed
        //provides for a confirm dialog on close. 
        utilities.exitApp();
    }//GEN-LAST:event_exitButtonFlagScreenActionPerformed

    private void irelandButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_irelandButtonActionPerformed
        homeScreenFrame newHomeScreenFrame = new homeScreenFrame(); //create instance of frame called newFrame
        newHomeScreenFrame.setVisible(true); //set it visible
        
        homeScreenFrame.currentTime.setText(now());
        
    }//GEN-LAST:event_irelandButtonActionPerformed

    private void irelandButtonMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_irelandButtonMouseEntered
       irelandButton.setBorderPainted(true);
    }//GEN-LAST:event_irelandButtonMouseEntered

    private void irelandButtonMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_irelandButtonMouseExited
       irelandButton.setBorderPainted(false);
    }//GEN-LAST:event_irelandButtonMouseExited

    private void franceButtonMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_franceButtonMouseEntered
        franceButton.setBorderPainted(true);
    }//GEN-LAST:event_franceButtonMouseEntered

    private void franceButtonMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_franceButtonMouseExited
        franceButton.setBorderPainted(false);
    }//GEN-LAST:event_franceButtonMouseExited

    private void spainButtonMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_spainButtonMouseEntered
        spainButton.setBorderPainted(true);
    }//GEN-LAST:event_spainButtonMouseEntered

    private void spainButtonMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_spainButtonMouseExited
        spainButton.setBorderPainted(false);
    }//GEN-LAST:event_spainButtonMouseExited

        public static String now() {
        // method uses calendar class to get current date and time for time and date on screens and reciept
        Calendar cal = Calendar.getInstance();
        SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
        return sdf.format(cal.getTime());      
        // method used for timestamp
    }
    

    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(LanguagePickFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(LanguagePickFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(LanguagePickFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(LanguagePickFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new LanguagePickFrame().setVisible(true);
            }
        
        
        });
    
    
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton exitButtonFlagScreen;
    private javax.swing.JPanel flagsPanel;
    private javax.swing.JToggleButton franceButton;
    private javax.swing.JToggleButton irelandButton;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel3;
    private javax.swing.ButtonGroup languageButtonGroup;
    private javax.swing.JLabel odeonLogoLbl;
    private javax.swing.JToggleButton spainButton;
    // End of variables declaration//GEN-END:variables
}

